<template>
  <div class="header">
    <div class="left-context">
<!--      <el-button size="medium" @click="changeCollapse" type="primary" style="margin-left: 20px"-->
<!--                 icon="el-icon-s-fold"></el-button>-->
      <span class="first-page">
<!--        面包屑-->
        <el-breadcrumb separator-class="el-icon-arrow-right" style="padding-left: 10px">
            <el-breadcrumb-item v-for="item in tags" :to="{path:item.path}" :key="item.path">
              {{ item.label }}
            </el-breadcrumb-item>
        </el-breadcrumb>
      </span>
    </div>
    <div class="right-context">
      <el-dropdown>
          <span class="el-dropdown-link">
            <img class="user-img" src="../../assets/images/team-icon-10-new.png">
          </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item @click.native="logout">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import {mapState} from 'vuex'

export default {
  name: "Header",
  methods: {
    changeCollapse() {
      // 处理store信息
      this.$store.commit("collapseChange")
    },
    logout() {
      this.$message.success("退出成功")
      localStorage.removeItem("userInfo")
      this.$router.push("/login")
    }
  },
  computed: {
    ...mapState({
      tags: state => state.tab.tabsList
    })
  },

}
</script>

<style lang="less" scoped>
.header {
  height: 60px;
  background-color: #636d72;
  // 弹性布局
  display: flex;
  justify-content: space-between;
  align-items: center;

  .left-context {
    display: flex;
    align-items: center;

    /deep/ .el-breadcrumb__item {
      .el-breadcrumb__inner {
        font-weight: normal;

        &.is-link {
          color: #636d72;
        }
      }
    }
  }

  .first-page {
    margin-left: 20px;
    font-size: 16px;
    color: #ffffff;
  }

  .right-context {
    padding-right: 20px;

    .user-img {
      width: 40px;
      height: 40px;
      border-radius: 50%;

    }
  }
}
</style>
